Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce PillarboxPreloadManager #726

Merged
merged 23 commits into from
Oct 14, 2024

Conversation

MGaetan89
Copy link
Member

@MGaetan89 MGaetan89 commented Sep 26, 2024

Pull request

Description

This PR introduces a PillarboxPreloadManager and related classes. It also updates the OptimizedStory to use this new helper.

The PillarboxPreloadManager takes the same arguments as DefaultPreloadManager/PillarboxExoPlayer, with the addition of a PlayerPool. This allows PillarboxPreloadManager to create player on-demand, and reuse them if needed.

Changes made

  • Introduce a new PillarboxPreloadManager.
  • Introduce a new PlayerPool.
  • Introduce a new PillarboxPreloadManager.
  • Introduce a new PillarboxRenderersFactory.
  • Introduce a new PillarboxTrackSelector.
  • Update StoryViewModel to use the new PillarboxPreloadManager.
  • Update OptimizedStory to scroll vertically instead of horizontally.
  • The pager indicator has been moved to the right of the screen instead of the bottom.
  • A progress indicator has been added at the bottom of each page.
  • Use StringUtil in SimplePlayerViewModel.

Note

AndroidX Media3 1.5.0 introduces some changes regarding preload manager. In particular, DefaultPreloadManager.Status.STAGE_LOADED_TO_POSITION_MS will become DefaultPreloadManager.Status.STAGE_LOADED_FOR_DURATION_MS, and will take milliseconds instead of microseconds.
This can be addressed once AndroidX Media3 1.5.0 is stable.

Checklist

  • Your branch has been rebased onto the main branch.
  • APIs have been properly documented (if relevant).
  • The documentation has been updated (if relevant).
  • New unit tests have been written (if relevant).
  • The demo has been updated (if relevant).
  • All pull request status checks pass.

@MGaetan89 MGaetan89 linked an issue Sep 26, 2024 that may be closed by this pull request
1 task
Copy link

github-actions bot commented Sep 26, 2024

Code Coverage

Overall Project 48.48% -0.42% 🟢
Files changed 62.9% 🟢

Module Coverage
:pillarbox-player 58.06% -0.19% 🟢
:pillarbox-ui 0.2% -1.49% 🟢
Files
Module File Coverage
:pillarbox-player PillarboxTrackSelector.kt 100% 🟢
PillarboxBandwidthMeter.kt 100% 🟢
PillarboxRenderersFactory.kt 100% 🟢
PillarboxPreloadManager.kt 86.29% -13.71% 🟢
PillarboxExoPlayer.kt 79.3% -0.63% 🟢
:pillarbox-ui AndroidPlayerSurfaceView.kt 0% -28.74% 🟢

@MGaetan89 MGaetan89 force-pushed the 709-redo-story-demo-with-preloadmanager-of-media3 branch 4 times, most recently from 83df4bc to 2c1c34d Compare October 1, 2024 08:58
@MGaetan89 MGaetan89 requested a review from StaehliJ October 1, 2024 09:12
@MGaetan89 MGaetan89 force-pushed the 709-redo-story-demo-with-preloadmanager-of-media3 branch from 5a2e70d to e77500c Compare October 3, 2024 07:32
@StaehliJ StaehliJ force-pushed the 709-redo-story-demo-with-preloadmanager-of-media3 branch from 30b7746 to b8df2e4 Compare October 9, 2024 13:32
@StaehliJ StaehliJ force-pushed the 709-redo-story-demo-with-preloadmanager-of-media3 branch from 7b4e09b to 62f33c0 Compare October 10, 2024 13:16
@MGaetan89 MGaetan89 force-pushed the 709-redo-story-demo-with-preloadmanager-of-media3 branch from 7feec9e to 1a1a9fe Compare October 11, 2024 12:45
@MGaetan89
Copy link
Member Author

Looks good to me 👍🏻

@StaehliJ I can't approve it, since I opened the PR. Feel free to approve it, then we can merge it.
I just pushed a couple small changes 1a1a9fe

@MGaetan89
Copy link
Member Author

I've switched the runner for the Android Tests step to ubuntu-22.04. See #736 (comment) for more details.

@MGaetan89
Copy link
Member Author

Looks like Google will make it easier to share parameters between the DefaultPreloadManager and ExoPlayer in the next version: androidx/media@98dc7f2

@MGaetan89
Copy link
Member Author

I've reverted my change to the runner.
See #747 (comment)

@MGaetan89 MGaetan89 force-pushed the 709-redo-story-demo-with-preloadmanager-of-media3 branch from cbc2f07 to 8ec2009 Compare October 14, 2024 08:53
@StaehliJ StaehliJ added this pull request to the merge queue Oct 14, 2024
Merged via the queue into main with commit 72896e7 Oct 14, 2024
9 checks passed
@StaehliJ StaehliJ deleted the 709-redo-story-demo-with-preloadmanager-of-media3 branch October 14, 2024 09:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

Redo Story demo with PreloadManager of Media3
2 participants